package net.biubiubiu.webSocket;

import java.io.IOException;

import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

/**
 * websocket例子
 * @author Jay
 *
 */
@ServerEndpoint("/websocket/biu")
public class WebSocketController {
	@OnOpen
	public void onOpen(Session session) {
		System.out.println("onOpen");
	}

	@OnClose
	public void onClose(Session session) {
		System.out.println("OnClose");
	}

	@OnMessage
	public void onMessage(String requestJson, Session session) throws IOException {
		session.getBasicRemote().sendText(requestJson);
	}
}
